package com.coursehub.course.repository;

import com.coursehub.course.entity.Material;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MaterialRepository extends JpaRepository<Material, String> {
    
    /**
     * 根据章节ID查找资料
     */
    List<Material> findByChapter_ChapterId(String chapterId);
    
    /**
     * 根据课程ID查找资料
     */
    List<Material> findByCourse_CourseId(String courseId);
    
    /**
     * 根据课程ID和章节ID查找资料
     */
    List<Material> findByCourse_CourseIdAndChapter_ChapterId(String courseId, String chapterId);
}